*** Settings ***
Documentation           通过Redfish获取bios设置信息
Resource                ../../test_function/redfish/redfish.robot
Resource                ../../test_function/resource.robot
Library                 RequestsLibrary
Library                 Collections
Library                 BuiltIn
Suite Setup             Create REDFISH_GET Session
Suite Teardown          Delete All Sessions

*** Variables ***
${INPUT_URI}            /Systems/${SYSTEM_ID}/Bios/Settings

*** Test Cases ***
Get BIOS Settings Via Redfish
    [Documentation]    通过Redfish获取bios设置信息
    [Tags]    Get_BIOS_Settings_Via_Redfish
    # 发送GET请求
    ${rsp}=    Run Keyword And Ignore Error    GET On Session    redfish_get    ${INPUT_URI}

    Run Keyword If     '${rsp[0]}' == 'FAIL'    Fail    msg=获取bios设置失败: ${rsp[1]}

    # 验证响应状态码
    Should Be Equal As Strings    ${rsp[1].status_code}    200    msg=预期状态码200,实际收到${rsp[1].status_code}

    # 打印响应内容
    Log    ${rsp[1].json()}    level=INFO

    # 验证bios设置项的内容：Attributes
    ${bios_settings}=    Set Variable    ${rsp[1].json()}
    ${attributes_name}=    Set Variable    Attributes

    # 检查响应中是否包含Atrributes
    Dictionary Should Contain Key    ${bios_settings}    ${attributes_name}
    Log    bios设置项${attributes_name}的值为: ${bios_settings['${attributes_name}']}    level=INFO
